﻿using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Contoso_University.Models
{
    public class Course
    {
        public Course()
        {
            Enrollments = new List<Enrollment>();
            CourseAssignments = new List<CourseAssignment>();
        }

        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Display(Name = "课程编号")]
        public int CourseID { get; set; }

        [StringLength(50, MinimumLength = 3)]
        [Display(Name = "课程名称")]
        public string Title { get; set; }

        [Range(0, 5)]
        [Display(Name = "学分")]
        public int Credits { get; set; }

        public int DepartmentID { get; set; }

        [Display(Name = "所属院系")]
        public Department? Department { get; set; }
        public ICollection<Enrollment> Enrollments { get; set; }
        public ICollection<CourseAssignment> CourseAssignments { get; set; }
    }
}
